Repository navigation
[ENG-13007] fix(supervisor): hold a displaced gateway only while it is still relaying - #31
Conversation
…ying A departed gateway member was held for the whole OPENSHELL_FLEET_DRAIN_SECS window. With the drain set to a gateway's shutdown drain (hours), a healthy replica that a scale-out merely displaced kept its session for as long as the session stayed up. Split the hold in two. Every departed member is held for a fixed 120 s skew window (callers' views may lag that much), measured from first absence as before. Past it, the member is held only while its session carries an in-flight relay, up to the OPENSHELL_FLEET_DRAIN_SECS ceiling. A drain below the skew window shortens both, so a short or zero drain keeps its meaning. An ended session still drops immediately, and returning to the subset clears the hold. Relays are counted per session with an RAII guard taken when RelayOpen is received and moved into the relay task, so completion, error, panic and abort all release it. SSH and TCP relays both count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cameron motevasselani <cameron@kindo.ai>
|
/ok to test |
|
/ok |
Test resultsNothing in CI or the unit tests points at this PR. Cluster results: #31 (comment) CI on the PR
Branch Checks and Helm Lint, run by hand
Unit tests, run locally:
Tested on a cluster afterwards: k3d end-to-end results are in #31 (comment). |
k3d end-to-end testI ran #31 on a local k3d cluster and compared it with a control on main's current pin (#30). Setup: 3 gateway replicas, The gateway image is byte-identical between #30 and #31; only the supervisor changes.
Notes:
|
Summary
Fixes ENG-13007. The supervisor kept a session to a displaced gateway replica for the whole
OPENSHELL_FLEET_DRAIN_SECSwindow. Since #30, Kindo's chart sets that window to the gateway's shutdown drain (about 3 h). So a healthy replica that a scale-out merely pushed out of a sandbox's subset kept its session for hours, and a scale-out freed no sessions on the replicas it displaced. The gateway HPA scales on memory, so it could keep scaling towardmaxReplicas.The opposite bug existed before #30: a displaced replica that was still relaying a long exec was dropped after 120 s, which killed that exec.
Changes
gateway_fleet.rs):SKEW_WINDOW), measured from first absence, as before. This keeps the superset guarantee for callers' lagging views.OPENSHELL_FLEET_DRAIN_SECSceiling.0still means "drop at once" for an idle member.supervisor_session.rs):Arc<AtomicUsize>per member session, with an RAIIRelayGuard.RelayOpenbefore the spawn and moved into the relay task, so completion, error, panic and abort (even before first poll) all release it.openshell-core.There's no new env var: the skew window is derived from DNS TTL and re-resolve intervals, which operators don't tune per deployment. With the variable unset, stock behaviour is unchanged.
Testing
cargo fmt --checkis clean.cargo clippyshows no new warnings in the changed files.cargo test -p openshell-supervisor-process: 178 passed.cargo test -p openshell-core: 479 passed, 1 failed. The failure isresolve_members_builds_addresses_from_resolved_ips, which resolveslocalhostthrough public DNS and fails in that environment. This PR only changes doc comments in that crate.subsetSize2.Checklist
🤖 Generated with Claude Code